#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;

int change(int amount, vector<int>& coins) {
    int dp[amount+1];
    fill(dp, dp + amount + 1, 0);
    //memset(dp, 0, sizeof(dp));
    dp[0] = 1;
    for (unsigned int i = 0; i < coins.size(); i++) {
        for (int j = coins[i]; j <= amount; j++) {
            dp[j] += dp[j - coins[i]];
        }
    }
    return dp[amount];

}

int main(){
    vector<int> coins = {1, 2, 5};
    cout << change(5, coins) << endl;

    return 0;
}